import java.util.*;

/**
 * @author LKQ
 * @date 2022/4/4 10:02
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] num1 = {55,30,5,4,2}, num2 = {100,20,10,10,5};
        solution.maxDistance(num1, num2);
    }
    public int maxDistance(int[] nums1, int[] nums2) {
        int m = nums1.length, n = nums2.length;
        int p = 0, q = 0;
        int max = 0;
        while (p < m && q < n) {
            if (nums1[p] <= nums2[q]) {
                if (p >= q) {
                    q++;
                    continue;
                }
                max = Math.max(max, q - p);
                q++;
            }else {
                p++;
            }
        }
        return max;
    }
}
